<div class="SipeiInfo pt20">
<?php
    $form = $this->beginWidget('CActiveForm', array(
    'method' => 'POST',
    'id' => 'myform',
    'htmlOptions' => array('name' => 'myform','target' => 'ajax-frame')
    ));
    ?> 
    <table class="fontc_666 height32">
    <tbody>
        <tr height="55">
            <td valign="top" width="145" align="right" class="pr5"><span class="pr5 fontc_orange_red">*</span>角色代码：</td>
            <td valign="top" width="350" class="formValidator_td">
                <input type="text" value="<?php echo $roleObject['role_code']; ?>" id='role_code' name="role_code"  class="col3 pt5 pr10 pb5 pl10 height20 border_c border_3 fontc_666">
                <div class="formValidator_tip">
                    <p id="role_codeTip" ></p>
                </div>
            </td>
        </tr>
        <tr height="55">
            <td valign="top" align="right" class="pr5"><span class="pr5 fontc_orange_red">*</span>角色名称：</td>
            <td valign="top" class="formValidator_td">
                <input type="text" value="<?php echo $roleObject['role_name']; ?>" id='role_name' name="role_name" class="col3 pt5 pr10 pb5 pl10 height20 border_c border_3 fontc_666">
                <div class="formValidator_tip">
                    <p id="role_nameTip" ></p>
                </div>
            </td>
        </tr>
        <tr>
            <td align="right" valign="top" class="pr5">角色权限：</td>
            <td>
                <?php echo $list; ?>
            </td>
        </tr>
        <tr>
            <td align="right" valign="top" name="description" class="pt20 pr5">备注：</td>
            <td class="pt20"><textarea class="col3 pt6 pr10 pb6 pl10 border_c border_3 fontc_666" name="description"><?php echo $roleObject['description']; ?></textarea></td>
        </tr>
        <tr>
            <td colspan="2" align="center" class="pt20 pb20">
                <input type="hidden" name="role_id" value="<?php echo $rid; ?>" />               
                <input type="submit" value="保存" name="submit" class="b_a_n border_3 back_bgfb w80 height32 fontc_FFF fonts_12 mr10 cursor">
                <input type="button" value="取消" onClick="api.close()" class="b_a_n border_3 back_bgb w80 height32 fontc_FFF fonts_12 cursor">
            </td>
        </tr>
    </tbody>
</table>
</div>
<?php $this->endWidget(); ?>
<iframe src='' style="display:none" name='ajax-frame'></iframe>
<script type="text/javascript">
$(function() {
	var indexArray = [], j = 0;
	$(".treeBox").each(function() {
		if ($(this).find(".click_on").length > 0) {
			j++;
			$(this).attr("treeBox", "treeBox" + (j - 1)).addClass("cursor");
		} else {
			$(this).addClass("treeBox" + (j - 1) + "_sun");
		}
	});
	$(".click_on").parent().parent().click(function() {
		var sunClass = $(this).attr("treeBox");
		$("ul[class$='_sun']").not().hide();
		$("." + sunClass + "_sun").show();
	});
	$('ul[treebox="treeBox0"]').click();

	$(".click_on").next().click(function() {
		var che = $(this).val();
		if($(this).attr('checked') == 'checked'){
			$(".parent_"+che).attr('checked','checked');
		}else{
			$(".parent_"+che).attr('checked',false);
		}
	});
	
});


$(function(){
	$.formValidator.initConfig({formID:"myform",theme:"126",submitOnce:false,
	onError:function(msg,obj,errorlist){
		$("#errorlist").empty();
		$.map(errorlist,function(msg){
			$("#errorlist").append("<li>" + msg + "</li>")
		});
		alert(msg);
	},
	ajaxPrompt : '有数据正在异步验证，请稍等...'
	});

	/*角色代码验证*/
	$("#role_code").formValidator({
		onShowText:"请输入角色代码",
		onShow:"",
		onFocus:"",
		onCorrect:"输入正确",
		leftTrim:true,
		rightTrim:true
	}).regexValidator({
		regExp:"^[a-zA-Z]{1,}([0-9]|[a-zA-Z])+$",
		onError:"角色代码格式不正确"
	});


	/*角色名称验证*/
	$("#role_name").formValidator({
		onShowText:"请输入角色名称",
		onShow:"",
		onFocus:"",
		onCorrect:"输入正确",
		leftTrim:true,
		rightTrim:true
	}).inputValidator({
		min:1,
		onError:"角色名称不能为空"
	});
	
})

</script>
<?php exit;?>